package cc.site.main.controller;

import cc.site.common.utils.R;

import cc.site.main.tools.OssTools;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @CREATE By yangruomao On 2024/4/13
 */
@RestController
@RequestMapping("/oss")
@Api(tags = "OSS文件存储服务")
public class OssController {

    @PostMapping("/upload")
    @ApiOperation("上传文件并返回加载url")
    public R upload(MultipartFile file) {

        String url = OssTools.upload(file);

        return R.ok().data("url", url);
    }
}
